<template>
  <div id="app">
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
    >
      <el-menu-item>OfferShow</el-menu-item>
      <el-menu-item>
        <el-input
          @keyup.enter.native="confirm"
          placeholder="请输入内容"
          v-model="input3"
        >
          <el-button
            slot="append"
            @click="confirm"
            icon="el-icon-search"
          ></el-button> </el-input
      ></el-menu-item>
    </el-menu>
    <div v-loading="loading" class="body">
      <div class="body_right" style="background: #f3f3f3">
        <salary
          v-for="item in salarys"
          :salaryinfo="item"
          v-bind:key="item"
        ></salary>
      </div>
    </div>
  </div>
</template>
<script>
var axios = require("axios");
var qs = require("qs");
import salary from "./salary";
export default {
  components: {
    salary: salary,
  },
  data() {
    return {
      loading: false,
      input3: "",
      activeIndex: "1",
      activeIndex2: "1",
      salarys: [],
    };
  },
  methods: {
    confirm() {
      var t = this.input3;
      this.search(t);
    },
    search: function (cont) {
      var that = this;
      this.loading = true;
      var data = qs.stringify({
        content: cont,
        search_priority: "1",
        ordertype: "1",
        part_school: "校招",
        year: "2021",
        education: "",
        access_token: "$yt1kzhL23Ivv5+sYwy23tkg26423Hjr62pCoff11ersh223owzjuaz",
      });
      var config = {
        method: "post",
        url: "/webapi/v2/search_salary",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
        data: data,
      };
      axios(config)
        .then(function (response) {
          console.log(response.data);
          that.salarys = response.data.info;
          console.log(that.salarys);
          that.loading = false;
        })
        .catch(function (error) {
          console.log(error);
        });
    },
  },
};
</script>
<style scoped>
.body {
  display: flex;
  align-items: center;
}
.body_right {
  height: 100vh;
  width: 100%;
}
.body_right {
  overflow-y: scroll;
}
</style>
